package ControlLayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class DVDCtrTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class DVDCtrTest
{
    /**
     * Default constructor for test class DVDCtrTest
     */
    public DVDCtrTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }
    
    @Test
    public void testCreateDVD()
    {
        DVDCtr dc = new DVDCtr();
        dc.createDVD(1, "Burn", "DMX", 1993);
        assertNotNull(dc.getDVD(1));
    }
    
    @Test
    public void testUpdateDVD()
    {
        DVDCtr dc = new DVDCtr();   
        dc.createDVD(2,"Burn", "DMX", 6548556);          
        dc.updateDVD(1,2,"Ivaylo");
        assertEquals("Ivaylo", dc.getDVD(2).getTitle());
    }
    
    @Test
    public void testDeleteDVD()
    {        
        DVDCtr dc = new DVDCtr();
        dc.createDVD(3,"Ivo", "Home", 9000);
        dc.deleteDVD(3);
        assertNotNull(dc.getDVD(3));
    }
    
    @Test
    public void testCreateCopy()
    {
        DVDCtr dc = new DVDCtr();
        dc.createCopy(1, 1993, 12021995, 2000);
        assertNotNull(dc.getCopy(1,1993));
    }
    
    @Test
    public void testUpdateCopy()
    {
        DVDCtr dc = new DVDCtr();   
        dc.createCopy(2,15, 120, 2000);          
        dc.updateCopy(2, 2, 15, "100");
        assertEquals(100, dc.getCopy(2, 15).getPurchasePrice());
    }
    
    @Test
    public void testDeleteCopy()
    {        
        DVDCtr dc = new DVDCtr();
        dc.createCopy(3, 105, 120, 2000);
        dc.deleteCopy(3, 105);
        assertNotNull(dc.getCopy(3, 105));
    }    
}
